//
//  MineHeaderView.swift
//  HR
//
//  Created by zhenyu on 17/6/24.
//  Copyright © 2017年 allblue. All rights reserved.
//

import UIKit

class MineHeaderView: UIView {
  
  weak var avatar: UIImageView!
  weak var name: UILabel!
  weak var arrow: UIImageView!

  // MARK: - LifeCycle
  convenience init() {
    let frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: 84 + 12)
    self.init(frame: frame)
  }
  
  override init(frame: CGRect) {
    super.init(frame: frame)
    setViews()
  }
  
  required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }
  
  // MARK: - SetViews
  func setViews() {
    backgroundColor = UIColor.white
    
    avatar = UIImageView(image: #imageLiteral(resourceName: "m_header")).then({ (i) in
      addSubview(i)
      i.snp.makeConstraints({ (make) in
        make.centerY.equalTo(self)
        make.left.equalTo(23)
      })
    })
    
    arrow = UIImageView(image: #imageLiteral(resourceName: "m_arrow_selected")).then({ (i) in
      addSubview(i)
      i.snp.makeConstraints({ (make) in
        make.centerY.equalTo(self)
        make.right.equalTo(self.snp.right).offset(-20)
      })
    })
    
    name = UILabel().then({ (l) in
      addSubview(l)
      l.textColor = Color.theme
      l.font = HRFont(size: 15)
      l.text = "登录/注册"
    }).then({ (l) in
      l.snp.makeConstraints({ (make) in
        make.centerY.equalTo(self)
        make.right.equalTo(arrow.snp.left).offset(-18)
      })
    })
  }
}
